import axios from "axios";
axios.defaults.baseURL = 'http://127.0.0.1:3000'
axios.defaults.timeout = 10000
//登陆界面处理
function dologin( params ) {
    return axios.post("/admin/dologin", params);
}
//用户所在社区表单提交
function post_community( params ) {
    return axios.post("/admin/post_community", params);
}
//查询所有充电桩位置信息
function get_chargeStation(params) {
    return axios.get("/chargeStation/get_chargeStation",{
        params
    });
}
//根据id查询充电桩位置信息
function get_chargeStationby_id(params) {
    return axios.get("/chargeStation/get_chargeStationby_id",{
        params:{charge_id:params}
    });
}
//根据id更改充电桩状态信息
function change_chargeStationby_id(charge_id,charge_station_status) {
    return axios.get("/chargeStation/change_chargeStationby_id",{
        params:{charge_id,charge_station_status}
    });
}
//存入充电桩订单信息
function post_order(params) {
    return axios.post("/order/post_order", params);
}
//获取充电桩订单信息通过名字
function get_order(param) {
    return axios.get("/order/get_order", {
        params:{username:param}
    });
}
//获取充电桩订单信息通过订单id
function get_orderby_id(param) {
    return axios.get("/order/get_orderby_id", {
        params:{order_id:param}
    });
}
//获取收藏信息通过名字
function get_loveStation(param) {
    return axios.get("/love/get_loveStation", {
        params:{username:param}
    });
}
//存入收藏信息通过名字
function post_loveStation(params) {
    return axios.post("/love/post_loveStation", params);
}
//取消收藏通过charge_id
function cancel_loveStation(param) {
    return axios.get("/love/cancel_loveStation", {
        params:{charge_id:param}
    });
}

function upload_file(data) {
    return axios.post("/upload/upload_file", data, {
        headers:{
            'content-type':'multipart/form-data; charset=utf-8'
        }
    });
}
export { upload_file,dologin,post_community,get_chargeStation,get_chargeStationby_id,change_chargeStationby_id,post_order,get_order,get_orderby_id,get_loveStation,post_loveStation,cancel_loveStation };
